package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsDeviceMonitorDataConfig;
import com.econ.powercloud.ems.dal.mapper.EmsDeviceMonitorDataConfigMapper;
import org.springframework.stereotype.Repository;

/**
 * @Author : zjf
 * @Description :
 * @Date : 2023/6/10 17:18
 * @Modified by : zjf
 */
@Repository
public class EmsDeviceMonitorDataConfigDAO extends ServiceImpl<EmsDeviceMonitorDataConfigMapper,EmsDeviceMonitorDataConfig> {

    public EmsDeviceMonitorDataConfig selectOneByDeviceCode(String deviceCode,Integer ditType){
        LambdaQueryWrapper<EmsDeviceMonitorDataConfig> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(EmsDeviceMonitorDataConfig::getDeviceCode,deviceCode);
        wrapper.eq(EmsDeviceMonitorDataConfig::getDitType,ditType);
        wrapper.last("limit 1");
        return this.baseMapper.selectOne(wrapper);
    }

}
